﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EnvDTE80;

namespace Dora
{
    public partial class ErrorList : Form
    {
        public ErrorList(List<ErrorItem> errors)
        {
            InitializeComponent();
            for (int i = 0; i < errors.Count; i++)
            {
                dgErrors.Rows.Add(errors[i].Description, Path.GetFileName(errors[i].FileName), errors[i].Line, errors[i].Column, Path.GetFileName(errors[i].Project));
            }
        }

        private void dgErrors_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            var res = Core.Analyzer.MakeRequest(null, null, "", null, dgErrors.Rows[e.RowIndex].Cells["dgvcDescription"].Value.ToString());
            var f = new SearchResultForm(res, dgErrors.Rows[e.RowIndex].Cells["dgvcDescription"].Value.ToString());
            f.ShowDialog();
        }
    }
}
